package site.hanzhe.security;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import site.hanzhe.entity.AdminEntity;

import java.util.List;

/**
 * 自定义User类以实现获取登录人详细信息(entity)的功能
 */
public class AdminDetails extends User {

    private final AdminEntity entity;

    public AdminDetails(AdminEntity entity, List<GrantedAuthority> authorities) {
        super(entity.getAccount(), entity.getPassword(), authorities);
        entity.setPassword("******");
        this.entity = entity;
    }

    public AdminEntity getEntity() {
        return entity;
    }

}
